
#include <algorithm/shared/utils/Rotation.h>
#include <utils/Format.h>

#include <boost/algorithm/string.hpp>

namespace solar
{

    /*
        kAxis
        kAngle
    */

    auto Rotation::toString() const -> std::string
    {
        return ::solar::format("{}, {}", axis_.toString(), angle_);
    }

    auto Rotation::fromString(const std::string& input) -> Rotation
    {
        std::vector<std::string> split_strings;
        boost::split(split_strings, input, boost::is_any_of(" ,"), boost::token_compress_on);
        return {std::stod(split_strings[0]), std::stod(split_strings[1]),
                std::stod(split_strings[2]), std::stod(split_strings[3])};
    }

} // namespace solar
